home *** CD-ROM | disk | FTP | other *** search
- /*
- Misc.c
-
- This file contains utility and menu handling routines.
-
- ©1992 Apple Computer, Inc.
- All rights reserved.
- */
-
- #include <Desk.h>
- #include <Menus.h>
-
-
- #include <GXEnvironment.h>
- #include "GraphicsLibraries.h"
- #include <GXPrinting.h>
- #include "graphics shell.h"
-
-
- /*------ DoMenuCommand ---------------------------------------------------------------------------------------*/
- //
- // This routine handles the dispatching of our menu requests.
- //
- void DoMenuCommand(long menuResult)
- {
- short menuID;
- short menuItem;
- Str255 daName;
- OSErr err;
- gxDialogResult result;
-
- menuID = menuResult >>16;
- menuItem = menuResult & 0x0000ffff;
-
- switch (menuID)
- {
- case mApple:
- switch (menuItem)
- {
- case iAbout: /* display About box */
- break;
-
- default: /* handle DA selection */
- GetItem(GetMHandle(mApple), menuItem, daName);
- OpenDeskAcc(daName);
- break;
- }
- break;
-
- case mFile:
- switch (menuItem)
- {
- case iNew:
- /* create new window */
-
- err = DoCreateNew();
- break;
-
- case iOpen:
- /* open saved window */
-
- break;
-
- case iClose:
- /* close front window */
-
- DoDispose(FrontWindow());
- break;
-
- case iSave:
- /* save front window */
-
- break;
-
- case iPageSetup:
- /* perform page setup */
-
- HiliteMenu(0);
- err = DoFormat(FrontWindow(), &result);
- break;
-
- case iPrintOne:
- /* perform print-one */
-
- err = DoPrintOneCopy(FrontWindow());
- break;
-
- case iPrint:
- /* perform print */
-
- HiliteMenu(0);
- err = DoPrinting(FrontWindow());
- break;
-
- case iQuit:
- gQuitting = true;
- break;
- }
- break;
-
- case mEdit:
- break;
- }
- HiliteMenu(0);
- }
-
-
-
- /*------ GetDocShape ---------------------------------------------------------------------------------*/
- //
- // This utility routine returns the page gxShape (contents) attached to a window's document.
- //
- gxShape GetDocShape(WindowPtr wind)
- {
- TH_Doc doc;
- gxShape docPage = nil;
-
- if (wind)
- {
- doc = (TH_Doc) GetWRefCon(wind);
- docPage = (*doc)->docPage;
- }
-
- return docPage;
- }
-
-
- /*------ GetDocJob -----------------------------------------------------------------------------------*/
- //
- // This utility routine returns the print job attached to a window's document.
- //
- gxJob GetDocJob(WindowPtr wind)
- {
- TH_Doc doc;
- gxJob docJob = nil;
-
- if (wind)
- {
- doc = (TH_Doc) GetWRefCon(wind);
- docJob = (*doc)->docJob;
- }
-
- return docJob;
- }
-